package com.zhanghp.object;

import com.zhanghp.visitor.AccountantVisitor;
import com.zhanghp.visitor.CompanyVisitor;
import com.zhanghp.visitor.EmployeeVisitor;
import lombok.extern.slf4j.Slf4j;

/**
 * 会计
 *
 * @author zhanghp
 * @date 2022-08-16 15:08
 */
@Slf4j
public class Accountant implements Company{
    @Override
    public void accept(CompanyVisitor visitor) {
        if (visitor instanceof AccountantVisitor) {
            ((AccountantVisitor) visitor).visit(this);
        }else {
            log.warn("Only AccountantVisitor is allowed to visit the Accountant / Employee, your visitor identity is {}", visitor);
        }
    }

    @Override
    public String toString() {
        return " --> Accoutant <-- ";
    }
}
